home *** CD-ROM | disk | FTP | other *** search
- '**********************************************************
- 'A single session external program for use with Winpack 5.4
- '**********************************************************
-
- DIM status AS INTEGER
- DIM PMSCall AS STRING
- DIM FirstName AS STRING
- DIM ConnectedStation AS STRING
- DIM UserText AS STRING
- crlf$ = CHR$(13) + CHR$(10)
-
- '********************************************
- 'Extract five arguments from the command line
- '********************************************
-
- c$ = COMMAND$
- n% = 1
- argcount% = 1
- agin:
- tmp$ = MID$(c$, n%, 1)
- IF (tmp$ = " ") OR (tmp$ = "") THEN GOTO caught1
- carryon:
- n% = n% + 1
- GOTO agin
-
- caught1:
- IF n% > (LEN(c$) + 1) THEN GOTO disp
-
- SELECT CASE argcount%
- CASE 1
- arg1$ = MID$(c$, 1, n% - 1)
- argcount% = argcount% + 1
- totcrs% = LEN(arg1$)
- GOTO carryon
- CASE 2
- arg2$ = MID$(c$, totcrs% + 2, n% - (totcrs% + 2))
- totcrs% = totcrs% + LEN(arg2$)
- argcount% = argcount% + 1
- GOTO carryon
- CASE 3
- arg3$ = MID$(c$, totcrs% + 3, n% - (totcrs% + 3))
- totcrs% = totcrs% + LEN(arg3$)
- argcount% = argcount% + 1
- GOTO carryon
- CASE 4
- arg4$ = MID$(c$, totcrs% + 4, n% - (totcrs% + 4))
- totcrs% = totcrs% + LEN(arg4$)
- argcount% = argcount% + 1
- GOTO carryon
- CASE 5
- arg5$ = MID$(c$, totcrs% + 5, (LEN(c$) - (totcrs% + 4)))
- GOTO disp
- END SELECT
-
- disp:
- '*****************************************
- 'These are our five command line arguments
- '*****************************************
- status = VAL(arg1$)
- PMSCall = arg2$
- FirstName = arg3$
- ConnectedStation = arg4$
- UserText = arg5$
-
- '***************************************
- 'This is where you can put your actual
- 'external program to do something useful
- '***************************************
-
- '*********************************
- 'create a reply file for Winpack
- '*********************************
-
- OPEN "EXTERN\AAKEXT.REP" FOR OUTPUT AS #1
- status = -1: ' because we've finished with this program for this session
- RepText1$ = crlf$ + "Hello " + ConnectedStation + " Welcome to " + PMSCall + crlf$
- RepText2$ = "This is AAKEXT - an example external program for Winpack " + crlf$
- RepText3$ = "You entered " + arg5$ + " on the command line " + crlf$
- PRINT #1, status, RepText1$, RepText2$, RepText3$
- CLOSE #1
-
- END
-
-